<?php
/*
 * @Author: your name
 * @Date: 2020-12-14 10:01:51
 * @LastEditTime: 2020-12-14 11:01:45
 * @LastEditors: Please set LastEditors
 * @Description: 防火墙日志逻辑
 * @FilePath: /special/application/api/service/netfilter/FirewallRuleLogService.php
 */
namespace app\api\service\netfilter;

use app\api\model\NetfilterFirewallRuleLogModel;
use app\common\definition\netfilter\FirewallRuleDefinition;

class FirewallRuleLogService
{
    /**
     * @name: 归档防火墙
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-12-14 10:04:40
     */
    public function archived ($input, $save_data)
    {
        
        //内容json化后存入回传内容
        $save_data['back_content'] = json_encode($input['content']);
        //错误码
        $save_data['error_code'] = $input['error_code'];
        //错误消息
        $save_data['error_message'] = $input['error_message'];
        //将状态改为已归档
        $save_data['status'] = FirewallRuleDefinition::ARCHIVED_LOG_STATUS;
        //规则类型
        $save_data['type'] = $input['type'];

        $where = isset($save_data['id']) ? ['id' => $save_data['id']] : [] ;
        $NetfilterFirewallRuleLogModel = new NetfilterFirewallRuleLogModel();
        $NetfilterFirewallRuleLogModel->save($save_data, $where);
    }
}